//#include<bits/stdc++.h>
#include <iostream>
#include <queue>
#include <vector>
using namespace std;

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	int k,d,m,f;
	cin >> k >> d >> m >> f;
	priority_queue<int>pqk;
	priority_queue<int>pqd;
	priority_queue<int>pqm;
	priority_queue<int>pqf;
	int tmp;
	for (int i = 0;i < k;i++) cin >> tmp, pqk.push(tmp);
	for (int i = 0;i < d;i++) cin >> tmp, pqd.push(tmp);
	for (int i = 0;i < m;i++) cin >> tmp, pqm.push(tmp);
	for (int i = 0;i < f;i++) cin >> tmp, pqf.push(tmp);
	int q, a, b, c;
	vector<double>ans;
	cin >> q;
	for (int i = 0;i < q;i++) {
		cin >> a >> b >> c;
		double sum = 0;
		sum += pqk.top();
		pqk.pop();
		for (int j = 0;j < a;j++)
			sum += pqd.top(), pqd.pop();
		for (int j = 0;j < b;j++)
			sum += pqm.top(), pqm.pop();
		for (int j = 0;j < c;j++)
			sum += pqf.top(), pqf.pop();
		ans.push_back(sum / 11.0);
	}
	for (auto at : ans)
		printf("%.2f\n", at);
	return 0;
}